home *** CD-ROM | disk | FTP | other *** search
- head 1.4;
- branch ;
- access ;
- symbols ;
- locks ; strict;
- comment @ * @;
-
-
- 1.4
- date 91.10.07.17.40.43; author voelker; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 91.09.14.15.17.14; author mendel; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 90.06.26.21.29.08; author jhh; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 90.03.04.22.27.24; author douglis; state Exp;
- branches ;
- next ;
-
-
- desc
- @header file for disk library.
- @
-
-
- 1.4
- log
- @added declarations of LFS checkpoint header and area write routines
- @
- text
- @/*
- * disk.h --
- *
- * Definitions for utilities that examine an OFS filesystem through
- * a raw disk interface.
- *
- * Copyright 1990 Regents of the University of California
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies. The University of California
- * makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without
- * express or implied warranty.
- *
- * $Header: /sprite/src/lib/c/disk/RCS/disk.h,v 1.3 91/09/14 15:17:14 mendel Exp Locker: voelker $ SPRITE (Berkeley)
- */
-
- #ifndef _DISK
- #define _DISK
-
- #include <sys/file.h>
-
- #include <kernel/fs.h>
- #include <kernel/dev.h>
- #include <kernel/fsdm.h>
- #include <kernel/ofs.h>
- #include <kernel/devDiskLabel.h>
-
- /*
- * include files for LFS structures and constants
- */
- #include <kernel/lfsDesc.h>
- #include <kernel/lfsDescMap.h>
- #include <kernel/lfsFileLayout.h>
- #include <kernel/lfsSegLayout.h>
- #include <kernel/lfsStableMem.h>
- #include <kernel/lfsSuperBlock.h>
- #include <kernel/lfsUsageArray.h>
-
- /*
- * These should be here. They should be in some machine dependent header
- * file. But for now ...
- */
- #define BITS_PER_BYTE 8
- #define BITS_PER_INT 32
-
- /*
- * DISK_SECTORS_PER_BLOCK Number of disk sectors per file system block.
- * DISK_KBYTES_PER_BLOCK Number of kbyte chunks per file system block.
- */
- #define DISK_SECTORS_PER_BLOCK (FS_BLOCK_SIZE / DEV_BYTES_PER_SECTOR)
- #define DISK_KBYTES_PER_BLOCK (FS_BLOCK_SIZE / 1024)
-
- /*
- * Maximum number of partitions on a disk.
- */
- #define DISK_MAX_PARTS 8
-
- /*
- * Maximum length of an ascii label inside a disk label.
- */
- #define DISK_MAX_ASCII_LABEL 256
-
- /*
- * We understand two types of native disk labels: Sun labels and DEC labels.
- */
-
- typedef int Disk_NativeLabelType;
-
- #define DISK_NO_LABEL ((Disk_NativeLabelType) 0)
- #define DISK_SUN_LABEL ((Disk_NativeLabelType) 1)
- #define DISK_DEC_LABEL ((Disk_NativeLabelType) 2)
-
- /*
- * Information about a disk partition.
- */
- typedef struct Disk_Partition {
- int firstCylinder; /* First cylinder in partition. */
- int numCylinders; /* Number of cylinders in partition.*/
- } Disk_Partition;
-
- /*
- * This is a canonical disk label. The use of this structure allows
- * programs to read and write disk labels without worrying about
- * the format of the machine-specific disk label. Fields labelled (RO)
- * are read-only. They should not be modified by a user program.
- * Fields labelled (+) can be modified by user programs, but the results
- * may not be what is desired. These fields reflect the location and size
- * of other data structures on the disk. Simply changing them in the
- * label will not suffice. The data structures will have to be moved also.
- * For some types of machines it is not possible to change these fields
- * because their location is hard-wired into the prom. Refer to the prom
- * documentation and kernel source code. The bottom line is you don't
- * want to change the (+) fields unless you really know what you're doing.
- */
- typedef struct Disk_Label {
- int numHeads; /* Number of heads */
- int numSectors; /* Number of sectors per track */
- int numCylinders; /* Number of cylinders on the disk. */
- int numAltCylinders; /* Number of alternate cylinders. */
- char asciiLabel[DISK_MAX_ASCII_LABEL]; /* Ascii label. */
- Disk_Partition partitions[DISK_MAX_PARTS]; /* Partition map */
- Disk_NativeLabelType labelType; /* Type of native disk label */
- char *labelPtr; /* Pointer to native disk label. */
- int bootSector; /* (+) Starting sector of boot program */
- int numBootSectors; /* (+) Number of boot sectors. */
- int summarySector; /* (+) Start of summary information. */
- int numSummarySectors; /* (+) Number of sectors in summary info. */
- int domainSector; /* (+) Sector where domain header starts. */
- int numDomainSectors; /* (+) Number of sectors in domain header. */
- int numPartitions; /* (RO) Number of partitions on disk. */
- int asciiLabelLen; /* (RO) Length of ascii label. */
- int labelSector; /* (RO) Location of native disk label. */
- } Disk_Label;
-
- /*
- * Return values for Disk_HasFilesystem.
- */
- #define DISK_HAS_NO_FS 0
- #define DISK_HAS_OFS 1
- #define DISK_HAS_LFS 2
-
- /*
- * Forward Declarations.
- */
- Disk_Label *Disk_ReadLabel();
- int Disk_WriteLabel();
- int Disk_EraseLabel();
- Disk_Label *Disk_NewLabel();
- Dec_DiskLabel *Disk_ReadDecLabel();
- Sun_DiskLabel *Disk_ReadSunLabel();
- Fsdm_DiskHeader *Disk_ReadDiskHeader();
- Ofs_SummaryInfo *Disk_ReadSummaryInfo();
- int Disk_WriteSummaryInfo();
- Ofs_DomainHeader *Disk_ReadDomainHeader();
- int Disk_WriteDomainHeader();
- void Disk_PrintDomainHeader();
- void Disk_PrintSummaryInfo();
- int Disk_BlockWrite();
- int Disk_SectorWrite();
- int Disk_BlockRead();
- int Disk_SectorRead();
- int Disk_BadBlockRead();
- void Disk_PrintLabel();
- char *Disk_GetLabelTypeName();
- void Disk_PrintFileDescBitmap();
- void Disk_PrintDataBlockBitmap();
- void Disk_PrintDirEntry();
-
-
- int Disk_HasFilesystem();
- LfsSuperBlock* Disk_ReadLfsSuperBlock();
- ReturnStatus Disk_WriteLfsSuperBlock();
- LfsCheckPointHdr* Disk_ReadLfsCheckPointHdr();
- ReturnStatus Disk_WriteLfsCheckPointHdr();
- ReturnStatus Disk_WriteLfsCheckPointArea();
- LfsCheckPointTrailer* Disk_LfsCheckPointTrailer();
- ReturnStatus Disk_ForEachCheckPointRegion();
- void Disk_PrintLfsSuperBlockHdr();
- void Disk_PrintLfsStableMemParams();
- void Disk_PrintLfsDescMapParams();
- void Disk_PrintLfsSegUsageParams();
- void Disk_PrintLfsFileLayoutParams();
- void Disk_PrintLfsSuperBlock();
- void Disk_PrintLfsCheckPointHdr();
- void Disk_PrintLfsCheckPointRegion();
- void Disk_PrintLfsCheckPointTrailer();
-
- #endif DISK
-
-
- @
-
-
- 1.3
- log
- @Changes to reflect the old Sprite file system name being OFS and the
- addition of LFS.
- @
- text
- @d16 1
- a16 1
- * $Header: /sprite/src/lib/c/disk/RCS/disk.h,v 1.2 90/06/26 21:29:08 jhh Exp $ SPRITE (Berkeley)
- d22 2
- d31 11
- d118 7
- d151 19
- d171 2
- @
-
-
- 1.2
- log
- @updated to new disk library
- @
- text
- @d4 1
- a4 1
- * Definitions for utilities that examine a filesystem through
- d16 1
- a16 1
- * $Header: /sprite/src/lib/c/disk/RCS/disk.h,v 1.1 90/03/04 22:27:24 douglis Exp Locker: douglis $ SPRITE (Berkeley)
- d22 5
- a26 4
- #include "kernel/fs.h"
- #include "kernel/dev.h"
- #include "kernel/fsdm.h"
- #include "kernel/devDiskLabel.h"
- d114 1
- a114 1
- Fsdm_SummaryInfo *Disk_ReadSummaryInfo();
- d116 1
- a116 1
- Fsdm_DomainHeader *Disk_ReadDomainHeader();
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d16 1
- a16 1
- * $Header: /sprite/lib/forms/RCS/proto.h,v 1.5 90/01/12 12:03:25 douglis Exp $ SPRITE (Berkeley)
- d25 1
- a25 1
- #include "devDiskLabel.h"
- d115 2
- d126 3
- @
-